package string;

public class findUniqueCharTest {
    public int findUniqueChar(String s){
        int [] num=new int[256];
        for (int i = 0; i < s.length(); i++) {
            num[s.charAt(i)]=num[s.charAt(i)]+1;
        }
        for(int j=0;j<s.length();j++){
            if (num[s.charAt(j)]==1){
                return j;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        String s="leetcode";
        findUniqueCharTest findUniquechar=new findUniqueCharTest();
        System.out.println(findUniquechar.findUniqueChar(s));
    }
}
